<?php
function code_tag_escape_filter($content) {
	return preg_replace_callback(
        "/<code(.*)>(.*)<\/code>/siU",
        "code_tag_escape",
        $content
    );
}
function code_tag_escape(&$match) {
	$match[2] = str_replace('&amp;', '&', htmlentities($match[2], ENT_COMPAT, 'UTF-8'));
	return "<code$match[1]>$match[2]</code>";
}
add_filter('the_content', 'code_tag_escape_filter');
add_filter('the_excerpt', 'code_tag_escape_filter');
add_filter('comment_text', 'code_tag_escape_filter');
?>